import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import JsonViewer from 'vue-json-viewer'
import 'vue-json-viewer/style.css'

import App from './App.vue'
import router from './router'
import './styles/performance.css'
import './styles/design-system.css'
import './styles/dialog-system.css'
import { logger } from './utils/logger'

const app = createApp(App)

// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(createPinia())
app.use(router)
app.use(ElementPlus, {
  locale: zhCn,
})
app.use(JsonViewer)

// 初始化日志系统
logger.info('Data Web Analytics application starting', {
  environment: import.meta.env.MODE,
  version: '1.0.0',
  timestamp: new Date().toISOString()
})

app.mount('#app')

// 应用启动完成日志
logger.info('Data Web Analytics application mounted successfully')
